CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

PROJECT(EyerWandStudioWuDaozi VERSION 1.0.0.0)

MESSAGE( STATUS "CMAKE_PROJECT_NAME    = ${CMAKE_PROJECT_NAME}" )
MESSAGE( STATUS "PROJECT_VERSION_MAJOR = ${PROJECT_VERSION_MAJOR}" )
MESSAGE( STATUS "PROJECT_VERSION_MINOR = ${PROJECT_VERSION_MINOR}" )
MESSAGE( STATUS "PROJECT_VERSION_PATCH = ${PROJECT_VERSION_PATCH}" )
MESSAGE( STATUS "PROJECT_VERSION_TWEAK = ${PROJECT_VERSION_TWEAK}" )
MESSAGE( STATUS "PROJECT_HOMEPAGE_URL = ${PROJECT_HOMEPAGE_URL}")
MESSAGE( STATUS "CMAKE_PROJECT_DESCRIPTION = ${CMAKE_PROJECT_DESCRIPTION}" )

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/QtLib/QtGui/)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/QtLib/)

INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/EyerLib_install/include)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/jsoncpp_install/include)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/glfw_install/include)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/freetype_install/include)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/freetype_install/include/freetype2)

LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/EyerLib_install/lib)
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/ffmpeg_install/lib)
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/x264_install/lib)
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/glfw_install/lib)
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/lame_install/lib)
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/jsoncpp_install/lib)
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/freetype_install/lib)
LINK_DIRECTORIES (${CMAKE_SOURCE_DIR}/../../Lib/libpng_install/lib)

SET(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install/)

IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
    MESSAGE(STATUS "current platform: Linux ")
    ADD_DEFINITIONS(-D EYER_PLATFORM_LINUX)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
    MESSAGE(STATUS "current platform: Windows")
    ADD_DEFINITIONS(-D EYER_PLATFORM_WINDOWS)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Android")
    MESSAGE(STATUS "current platform: Android")
    ADD_DEFINITIONS(-D EYER_PLATFORM_ANDROID)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
    MESSAGE(STATUS "current platform: Darwin")
    ADD_DEFINITIONS(-D EYER_PLATFORM_DARWIN)
    set(CMAKE_EXE_LINKER_FLAGS
        "-framework IOKit -framework AudioToolbox -framework CoreGraphics -framework CoreMedia -framework Cocoa -framework VideoToolbox -framework AVFoundation -framework Security -framework CoreFoundation -framework CoreVideo -framework OpenGL -framework AppKit -framework CoreImage -framework VideoDecodeAcceleration"
    )
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
    MESSAGE(STATUS "current platform: Emscripten")
    ADD_DEFINITIONS(-D EYER_PLATFORM_EMSCRIPTEN)
ELSE ()
    MESSAGE(STATUS "other platform: ${CMAKE_SYSTEM_NAME}")
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")

FUNCTION(ModuleTestOption moduleName moduleOption)
    IF (${moduleOption})
        ADD_SUBDIRECTORY(${moduleName})
    ENDIF(${moduleOption})
ENDFUNCTION(ModuleTestOption)

INCLUDE_DIRECTORIES (googletest/googletest/include)

# ADD_SUBDIRECTORY(googletest)
ADD_SUBDIRECTORY(EWSEvent)
ADD_SUBDIRECTORY(EWSFragmentUI)
ADD_SUBDIRECTORY(EWSSession)
ADD_SUBDIRECTORY(EWSUI)
ADD_SUBDIRECTORY(EWSUIEditor)
ADD_SUBDIRECTORY(EWSMediaSource)